--[[ 编码: WMS-20-15 名称: 空料箱呼出取消 作者:HAN 日期:2025-1-29 级别:项目 函数: ResetBSState 功能: 把入库单的状态设置为 0 更改记录: --]] wms_base= require( "wms_base" ) function ResetBSState ( strLuaDEID ) local nRet, strRetInfo -- step1 获取当前点中的任务 nRet, objs = m3.GetSysDataJson( strLuaDEID ) if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), objs ) end local n local obj_attrs, strCondition for n = 1, #objs do obj_attrs = m3.KeyValueAttrsToObjAttr( objs[n].attrs ) if ( lua.StrToNumber( obj_attrs.N_B_STATE ) == 1 ) then strOpNo = obj_attrs.S_NO if ( strOpNo == nil or strOpNo == '' ) then else -- 删除预分配容器 strCondition = "S_BS_NO = '"..strOpNo.."'" nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "Pre_Alloc_Container", strCondition ) if ( nRet ~= 0) then return lua.Error( strLuaDEID, debug.getinfo(1), "删除相关的【Pre_Alloc_Container】失败! "..strRetInfo ) end -- 容器解锁 wms.wms_UnlockCntrByTrans( strLuaDEID, strOpNo ) -- 设置业务状态为0 local strUpdateSql = "N_B_STATE = 0" local strCondition = "S_NO = '"..strOpNo.."'" nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Inbound_Order", strCondition, strUpdateSql ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【入库单】信息失败!"..strRetInfo ) end end end end local action = { { action_type = "refresh_cur_row", value = "" } } nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action)) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end end